package br.com.arndroid.coupman.site;

import greendroid.widget.item.SubtitleItem;
import greendroid.widget.itemview.ItemView;
import android.content.Context;
import android.database.Cursor;
import android.view.View;
import android.view.ViewGroup;
import br.com.arndroid.coupman.model.CouponOpenHelper;
import br.com.arndroid.lib.entity.EntityAdapter;

public class SiteAdapter extends EntityAdapter {

	public SiteAdapter(Context context, Cursor c) {
		super(context, c);
	}

	@Override
	public void bindView(View view, Context context, Cursor cursor) {		
		final SubtitleItem item = new SubtitleItem(cursor.getString(CouponOpenHelper.SITE_TABLE_NAME_COL_INDEX),
				cursor.getString(CouponOpenHelper.SITE_TABLE_URL_URI_COL_INDEX));
		((ItemView) view).setObject(item);
	}

	@Override
	public View newView(Context context, Cursor c, ViewGroup parent) {
		final ItemView view = new SubtitleItem().newView(context, parent);
		view.prepareItemView();
		return (View) view;
	}
}
